import React from 'react'
import { Select } from 'antd'

function SelectCom(props) {

    // console.log("props", props)

    const { Option } = Select;

    function onChange(value) {
        // value type is string
        // 通过 获取属性的方式获取当前对象的内容 进行判断
        // if(value === "0" )

        console.log(props)
        props.onChange(value)
        console.log("onChange",`selected ${value}`);

    }

    function onSearch(val) {
        console.log("onSearch",'search:', val);
    }

    return (
        <div>
            <Select
                showSearch
                placeholder="全部"
                optionFilterProp="children"
                onChange={onChange}
                onSearch={onSearch}
                filterOption={(input, option) =>
                    option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
                }
            >
                <Option value="0">{props.children.a}</Option>
                <Option value="1">{props.children.b}</Option>
                <Option value="2">{props.children.c}</Option>
                {/* <Option value="0">APP首页轮播</Option>
                <Option value="1">PC端首页轮播</Option>
                <Option value="2">PC端分类规则 123 </Option> */}
            </Select>
        </div>
    )
}

export default SelectCom
